<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue.js - 基础</title>
</head>

<body>
    <div id="app">
        <a href="#/">首页</a>
        <a href="#/video">视频</a>
        <a href="#/music">音乐</a>
        <a href="#/photo">美图</a>
        <a href="#/mine">关于我</a>
        <router-view></router-view>
    </div>

    <!-- 引入vue框架 开发版 :包含警告 和调试信息 -->
    <script src="../../lib/vue.js"></script>
    <script src="../../lib/vue-router.js"></script>
    <script>
        // 1.先为路由页面创建组件
        const Home = {
            template: `<div>这是首页</div>`
        }
        const Video = {
            template: `<div>这是视频</div>`
        }
        const Music = {
            template: `<div>这是音乐</div>`
        }
        const Photo = {
            template: `<div>这是美图</div>`
        }
        const Mine = {
            template: `<div>这是关于我</div>`
        }
        // 2.创建路由表
        const routes = [
            {
                path: "/",
                component: Home
            },
            {
                path: "/video",
                component: Video
            },
            {
                path: "/music",
                component: Music
            },
            {
                path: "/photo",
                component: Photo
            },
            {
                path: "/mine",
                component: Mine
            }
        ];
        // 3.创建vue路由对象
        const router = new VueRouter({
            routes
        })

        //vm 就是根组件
        let vm = new Vue({
            el: "#app",//指定Vue挂载的DOM
            data: {//当前vue实例中使用的数据

            },
            router,// 4. 将vue路由对象挂载到对应的vue实例对象
            methods: {//当前Vue实例中使用到的方法

            }
        })
    </script>
</body>

</html>